package com.hehua.AbstractFacadePattern;

import java.io.FileInputStream;

/**
 * 文件读取类,充当子系统类
 */
public class FileReader {
    public String read(String fileNameSrc){
        System.out.println("读取文件,获取明文");
        StringBuffer buffer = new StringBuffer();
        try {
            FileInputStream inputStream = new FileInputStream(fileNameSrc);
            int data;
            while ((data=inputStream.read())!=-1){
                buffer=buffer.append((char)data);
            }
            inputStream.close();
            System.out.println(buffer.toString());
        }catch (Exception e){
            e.printStackTrace();
        }
        return buffer.toString();
    }

}
